home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / apps / astronmy / noradsc.arc / norad.lst next >
File List  |  1990-06-07  |  35KB  |  1,078 lines

  1. REM      N.O.R.A.D. V2.0 The graphic realtime satellite tracking program.
  2. REM                    ATARI ST -- GFA BASIC 3.07
  3. REM               Please customize the six lines below.
  4. REM
  5. tlocal=-5             ! Your time difference from GMT (UTC). i.e. -5 = CDT
  6. l9=45.0709            ! Your latitude, degrees.fraction-of-degrees.
  7. w9=93.1567            ! Your longitude, degrees.fraction. i.e +values for USA
  8. h9=980                ! Your altitude above sea-level. (Feet)
  9. el$="C:\orbitals.dat" ! Path to orbital elements file. (NASA Predictions)
  10. ms=2000               ! Maximum number of satellites. (To reserve space)
  11. REM
  12. MODE 1                ! GFA Basic 3.07 compiler default override.
  13. REM
  14. REM Orbital calculation subroutines from the AMSAT Orbital Prediction Program
  15. REM (C) 1980 by Dr. T. A. Clark W3IWI, 6388 Guilford Road, Clarksville MD
  16. REM 21209 USA.  "Permission granted for non-commercial use provided credit is
  17. REM given to author, AMSAT and ORBIT magazine.  See ORBIT issue 6, March/
  18. REM April 1981.  Ported to ATARI ST BASIC by Scott Tilley (1/24/87.)
  19. REM
  20. REM Graphic interface and world map by John Logajan, 4248 Hamline, Arden Hills
  21. REM MN 55112 USA. 6/3/90  Graphic interface and map code are released into
  22. REM the public domain.    logajan@ns.network.com   john@logajan.mn.org
  23. REM
  24. CLS
  25. h9=h9*12/39.37  ! convert feet height to meters
  26. REPEAT
  27.   REPEAT
  28.     DEFTEXT 3,0,0,32
  29.     TEXT 100,25,0,"Welcome to N.O.R.A.D.   V2"
  30.     DEFTEXT 1,0,0,13
  31.     TEXT 105,45,0,"Your clock said the time was:  "+DATE$+"  "+TIME$
  32.     DEFTEXT 2,0,0,13
  33.     TEXT 100,61,0,"Please be sure it is set to the EXACT time and date!"
  34.     TEXT 175,152,0,"Press the HELP-key for instructions."
  35.     TEXT 220,170,0,"Press the ESC-key to exit."
  36.     TEXT 80,186,0,"- Point at satellite of interest and click to get its info -"
  37.     a$="Want to set/reset the clock?"
  38.     ALERT 2,a$,1,"No need|SetClock|Quit!",but
  39.     IF but=3
  40.       EDIT
  41.     ENDIF
  42.     IF but=2
  43.       CLS
  44.       PRINT "Enter date (or RETURN to skip)"
  45.       PRINT
  46.       PRINT "Use the format  month/day/year."
  47.       PRINT "Be sure to use two digits (leading zeroes) for each."
  48.       PRINT "Otherwise the system will ignore the new date."
  49.       PRINT
  50.       PRINT DATE$;
  51.       INPUT "  Date ";d$
  52.       CLS
  53.       PRINT "Enter local time (or RETURN to skip)"
  54.       PRINT
  55.       PRINT "Use the format  hour:minute:second."
  56.       PRINT "Be sure to use two digits (leading zeroes) for each."
  57.       PRINT "Otherwise the system will ignore the new time."
  58.       PRINT
  59.       PRINT TIME$;
  60.       INPUT "  Time ";t$
  61.       SETTIME t$,d$
  62.     ENDIF
  63.     CLS
  64.   UNTIL but=1
  65.   y=VAL(RIGHT$(DATE$,4))-1900
  66.   IF y<89
  67.     PRINT "          Is it really the year ";1900+y;" ?"
  68.     PRINT "I haven't made the program so it can work in years before 1989,"
  69.     PRINT "so I am going to force you to set your clock/calender."
  70.     ALERT 1," ",1,"continue",but
  71.     CLS
  72.   ENDIF
  73. UNTIL y>=89
  74. IF y/4=INT(y/4)
  75.   f9=1
  76. ELSE
  77.   f9=0                   ! leap-year flag
  78. ENDIF
  79. d=VAL(MID$(DATE$,4,2))
  80. m=VAL(LEFT$(DATE$,2))
  81. REM Calculate day of year
  82. DATA 0,31,59,90,120,151,181,212,243,273,304,334
  83. FOR i=1 TO 12
  84.   READ d9x
  85.   IF i=m
  86.     d9=d9x
  87.   ENDIF
  88. NEXT i
  89. d8=d+d9
  90. IF m>2
  91.   d8=d8+f9
  92. ENDIF
  93. t$=TIME$
  94. tstart=TIMER
  95. h=VAL(LEFT$(t$,2))
  96. s=VAL(RIGHT$(t$,2))
  97. m=VAL(MID$(t$,4,2))
  98. t7=d8+h/24+m/1440+s/86400-tlocal/24
  99. leapy=30/60/60/24
  100. r0=6378.135                          ! earth mean diameter km
  101. f=298.25                             ! delta diameter km
  102. f=1/f
  103. g0=75369793000000                    ! gravitational constant
  104. g1=1.0027379093                      ! sidereal/solar ratio
  105. p2=2*PI
  106. p0=PI/180
  107. pd2=PI/2
  108. pday=p2/365.2422           ! 2*pi/days per year
  109. seg=279.04247*p0           ! sun's ecliptic longitude at 1975
  110. swg=282.510396*p0          ! sun's ecliptic longitude at perigee
  111. see=0.01672*2              ! eccentricy of earth orbit
  112. sepoch=5114                ! days between 1975 and 1989 (my base year)
  113. obliq=23.4333333*p0        ! obliquity of the ecliptic
  114. cobliq=COS(obliq)
  115. sobliq=SIN(obliq)
  116. cl9p0=COS(l9*p0)
  117. sl9p0=SIN(l9*p0)
  118. dseg=seg-swg
  119. ltsun=0
  120. w9x=w9/15
  121. REM  Greenwich Sidereal Time at New Year's
  122. yt%=0
  123. FOR y1=90 TO y
  124.   yd%=365
  125.   IF y1/4=INT(y1/4)
  126.     yd%=366
  127.   ENDIF
  128.   yt%=yt%+yd%
  129. NEXT y1
  130. g2=FRAC(yt%*g1+0.27676779)           ! Figure forward from 0.0.1989 GMT
  131. sepoch=sepoch+yt%
  132. REM  Routine to evaluate OBSERVER's GEOCENTRIC Coordinates, where
  133. REM   X-axis=GREENWICH, Y-axis goes thru India, Z-axis=North Pole
  134. l8=l9*p0
  135. s9=SIN(l8)
  136. c9=COS(l8)                                   ! Initial GEOCENTRIC coordinates
  137. s8=SIN(-w9*p0)
  138. c8=COS(w9*p0)                                ! W9= West longitude
  139. REM Now to account for flattened Earth
  140. r9=r0*(1-(f/2)+(f/2)*COS(2*l8))+h9/1000      ! H9=height in meters
  141. REM Now to make L8 the GEOCENTRIC latitude
  142. l8=ATN((1-f)^2*s9/c9)
  143. z9=r9*SIN(l8)
  144. x9=r9*COS(l8)*c8
  145. y9=r9*COS(l8)*s8
  146. REM   *********** get Parameters for Satellites *********
  147. PRINT "Reading orbital elements from file: ";el$
  148. PRINT
  149. ON ERROR GOSUB missing
  150. OPEN "I",#1,el$
  151. msx%=LOF(#1)/141
  152. IF msx%<ms
  153.   ms=msx%
  154. ENDIF
  155. DIM c(3,2),lvt%(200),s$(ms),y3(ms),t0(ms),mmr(ms),i0(ms),o0(ms),e0(ms)
  156. DIM w0(ms),m0(ms),n0(ms),k0(ms),a0(ms),xx%(ms),yy%(ms),e(ms),prob|(ms)
  157. sp%=0
  158. ON ERROR GOSUB baddy
  159. DO
  160.   EXIT IF EOF(#1)
  161.   LINE INPUT #1,ln$
  162.   EXIT IF EOF(#1)
  163.   LINE INPUT #1,l1$
  164.   EXIT IF EOF(#1)
  165.   LINE INPUT #1,l2$
  166.   WHILE LEFT$(l1$,1)<>"1" OR LEFT$(l2$,1)<>"2"
  167.     ln$=l1$
  168.     l1$=l2$
  169.     EXIT IF EOF(#1)
  170.     LINE INPUT #1,l2$
  171.   WEND
  172.   INC sp%
  173.   s$(sp%)="[                    ]"
  174.   MID$(s$(sp%),2,14)=LEFT$(ln$,14)
  175.   MID$(s$(sp%),17,5)=MID$(l1$,3,5)
  176.   y3(sp%)=VAL(MID$(l1$,19,2))
  177.   t0(sp%)=VAL(MID$(l1$,21,12))
  178.   IF y3(sp%)<y                     ! Correct for "old" orbital elements
  179.     yt%=0
  180.     FOR y1=y3(sp%) TO y-1
  181.       yd%=365
  182.       IF y1/4=INT(y1/4)
  183.         yd%=366
  184.       ENDIF
  185.       yt%=yt%+yd%
  186.     NEXT y1
  187.     t0(sp%)=t0(sp%)-yt%
  188.     y3(sp%)=y
  189.   ENDIF
  190.   mmr(sp%)=VAL(MID$(l1$,34,10))
  191.   i0(sp%)=VAL(MID$(l2$,9,8))
  192.   o0(sp%)=VAL(MID$(l2$,18,8))
  193.   e0(sp%)=VAL("."+MID$(l2$,27,7))
  194.   w0(sp%)=VAL(MID$(l2$,35,8))
  195.   m0(sp%)=VAL(MID$(l2$,44,8))
  196.   n0(sp%)=VAL(MID$(l2$,53,11))
  197.   k0(sp%)=VAL(MID$(l2$,64,5))
  198.   a0(sp%)=((g0/(n0(sp%)^2))^(1/3))
  199.   e(sp%)=0
  200.   PRINT sp%;TAB(5);s$(sp%)
  201.   IF sp%=ms
  202.     PRINT "Oops! Not enough room reserved for all satellite elements."
  203.     PRINT "Increase the variable -Ms- to a higher number and try again."
  204.     EDIT
  205.   ENDIF
  206.   IF INP?(2)
  207.     IF INP(2)=27
  208.       EDIT
  209.     ENDIF
  210.   ENDIF
  211. LOOP
  212. ON ERROR
  213. IF sp%=0
  214.   GOSUB missing
  215. ENDIF
  216. CLOSE #1
  217. mxsp%=sp%-1
  218. mxsps%=sp%
  219. FOR i%=1 TO mxsp%
  220.   prob|(i%)=0
  221. NEXT i%
  222. nowreck!=FALSE
  223. IF FRE(0)>50000
  224.   nowreck!=TRUE
  225.   DIM helparray%(33000/4)
  226.   helpstuff%=INT(VARPTR(helparray%(0))/256)*256+256
  227.   keepalive%=XBIOS(2)
  228. ENDIF
  229. REM   ******** Here follows the actual computation loop *********
  230. CLS
  231. SETCOLOR 0,0,0,0  ! For color 0 (black -- background)
  232. SETCOLOR 1,0,0,7  ! For color 2 (blue -- trails)
  233. SETCOLOR 3,7,0,0  ! For color 1 (red -- satellites/text/arrow)
  234. SETCOLOR 2,3,2,0  ! For color 3 (brown -- world map)
  235. DEFMOUSE 0
  236. DEFFILL 3,1
  237. white!=FALSE
  238. hilite!=FALSE
  239. facts!=FALSE
  240. clkon!=FALSE
  241. clkfast!=FALSE
  242. mapon!=TRUE
  243. equat!=FALSE
  244. helpme!=FALSE
  245. lookup!=FALSE
  246. found!=FALSE
  247. sunfacts!=FALSE
  248. sunchk!=FALSE
  249. radaron!=FALSE
  250. leaptime!=FALSE
  251. vpage%=0
  252. d$=CHR$(248)
  253. GOSUB map
  254. DO
  255.   GOSUB sun
  256.   IF sunfacts!
  257.     GOSUB factsun
  258.   ENDIF
  259.   FOR sp%=1 TO mxsp%
  260.     IF (NOT radaron!) OR (radaron! AND prob|(sp%)<1)
  261.       t=t7+(TIMER-tstart)/17280000
  262.       GOSUB fnc
  263.       COLOR 2
  264.       IF hilite!
  265.         IF sp%=sr%
  266.           COLOR 1
  267.         ENDIF
  268.       ENDIF
  269.       PLOT xx%(sp%),yy%(sp%)
  270.       COLOR 1
  271.       IF sunchk! AND ((NOT radaron!) OR (radaron! AND e9>0))
  272.         gcca=COS((sunlng-wx5-180)*p0)
  273.         gcsatc=(90-l5)*p0
  274.         gcangle=(ACOS(gcbcos*COS(gcsatc)+gcbsin*SIN(gcsatc)*gcca))/p0
  275.         IF gcangle>90
  276.           shad=r*COS((gcangle-90)*p0)
  277.           IF shad<r0
  278.             COLOR 2
  279.           ENDIF
  280.         ENDIF
  281.       ENDIF
  282.       IF radaron!
  283.         IF e9=>0
  284.           rrr=90-e9
  285.           yy%(sp%)=100-rrr*COSQ(a9)
  286.           xx%(sp%)=2.4*rrr*SINQ(a9)+320
  287.           PLOT xx%(sp%),yy%(sp%)
  288.         ENDIF
  289.       ELSE
  290.         yy%(sp%)=1.11111111*(90-l5)
  291.         xx%(sp%)=1.77777777*(360-wx5)
  292.         PLOT xx%(sp%),yy%(sp%)
  293.       ENDIF
  294.     ELSE
  295.       DEC prob|(sp%)
  296.     ENDIF
  297.